

import java.util.concurrent.CountDownLatch;

import org.springframework.boot.Banner;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ImportResource;

/**
 */

@SpringBootConfiguration
@EnableAutoConfiguration
@ImportResource({"classpath:applicationContext.xml"})
public class Application {
    public static void main(String[] args) throws Exception {
        ApplicationContext ctx = new SpringApplicationBuilder()
            .bannerMode(Banner.Mode.OFF)
            .sources(Application.class)
            .web(false)
            .run(args);
        System.out.println("### 服务启动...");
        
        
        ctx.getBean(CountDownLatch.class).await();
    }
    
    
    @Bean
    public CountDownLatch closeLatch() {
        return new CountDownLatch(1);
    }    
}
